<?php
/**
 * Created by PhpStorm.
 * User: gaochaolyf
 * Date: 16/6/13
 * Time: 下午4:07
 */

namespace cash\Model;

use Think\Model;

class CustCashModel extends Model
{
    function __construct() {
        $this->model = M('CustCash');
    }

    public function getCashList($field = array('*'), $condition = array(), $order = 'cust_cashid ASC') {
        $data = $this->model->where($condition)->field($field)->order($order)->select();
        $data = $data ? $data : array();

        return $data;
    }

    public function getOneCash($field = array('*'), $condition = array()) {
        $data = $this->model->where($condition)->field($field)->find();
        $data = $data ? $data : array();

        return $data;
    }

    public function addOneCash($param = array()) {
        $insert_id = $this->model->data($param)->add();

        return $insert_id;
    }

    public function updateOneCash($param = array(), $condition = array()) {
        $affected = $this->model->where($condition)->setField($param);

        return $affected;
    }
}